<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>购票系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/booking2/css/font.css">
    <link rel="stylesheet" href="/booking2/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="/booking2/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/booking2/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-lg12">
            <input class="layui-hide" type="number" value="0" name="page" id="page">
          <input class="layui-input" type="number" placeholder="预定单ID" name="bookingId" id="bookingId" th:value="${bookingId}">
          <input class="layui-input" type="number" placeholder="票ID" name="ticket" id="ticket" th:value="${ticket }">
          <input class="layui-input" type="text"   placeholder="预定用户姓名" name="bookingName" id="bookingName" th:value="${bookingName}">
            <select name="bookdingStatus" id="bookdingStatus" class="layui-select">
                <option value="0" th:if="${bookdingStatus==0}">预定状态：预定中</option>
                <option value="1" th:if="${bookdingStatus==1}">预定状态：已过期</option>
                <option value="">预定状态：全部 </option>
                <option  value="0">预定状态：预定中</option>
                <option  value="1">预定状态：已过期</option>
            </select>
            <select name="bookingChangeStatus" id="bookingChangeStatus" class="layui-select" >
                <option value="0" th:if="${bookingChangeStatus==0}">改签状态：未改签</option>
                <option value="1" th:if="${bookingChangeStatus==1}">改签状态：已改签</option>
                <option value="">改签状态：全部 </option>
                <option value="0">改签状态：未改签</option>
                <option value="1">改签状态：已改签</option>
            </select>
            <select name="bookingRefundStatus" id="bookingRefundStatus" class="layui-select" >
                <option value="0" th:if="${bookingRefundStatus==0}">退票状态：正常</option>
                <option value="1" th:if="${bookingRefundStatus==1}">退票状态：已退票</option>
                <option value="">退票状态：全部 </option>
                <option value="0">退票状态：正常</option>
                <option value="1">退票状态：已退票</option>
            </select>
<!--          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>-->
            <button class="layui-btn"  href=""><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <table class="layui-table">
        <thead>
            <th>预订单ID</th>
            <th>票ID及票名</th>
            <th>预订人姓名</th>
            <th>预定时间</th>
            <th>预定人电话</th>
            <th>预定人身份证号码</th>
            <th>预定状态</th>
            <th>改签状态</th>
            <th>退票状态</th>
            <th>操作</th>
        </thead>
        <tbody>
        <tr th:each="x:${booksList}">
            <td th:text="${x.bookingId}"></td>
            <td th:text="${x.ticket.ticketId}+'【'+${x.ticket.ticketName}+'】'"></td>
            <td th:text="${x.bookingName}"></td>
            <td th:text="${x.bookingTime}"></td>
            <td th:text="${x.bookingTel}"></td>
            <td th:text="${x.bookingIdenty}"></td>
            <td >
                &emsp;<span th:if="${x.bookdingStatus==0}">预定中</span>
                 <span th:if="${x.bookdingStatus==1}">已过期</span>
            </td>
            <td >
                <span th:if="${x.bookingChangeStatus==0}">未改签</span>
                <span th:if="${x.bookingChangeStatus==1}">已改签</span>
            </td>
            <td >
                <span th:if="${x.bookingRefundStatus==0}">未退票</span>
                <span th:if="${x.bookingRefundStatus==1}">已退票</span>
            </td>
            <td >
                <a title="删除信息" onclick="deldate(this)" href="javascript:;" >
                    <i class="layui-icon">&#xe640;</i>
                </a>
            </td>
        </tr>
        </tbody>
      </table>
      <div class="page">
        <div>
          <a class="prev" th:href="@{'/book/list?page=' + ${lastPage} + '&bookingId='+ ${bookingId!=null ? bookingId :''} + '&ticket='+${ticket !=null ? ticket :''} + '&bookingName=' +${bookingName !=null ? bookingName :''} + '&bookdingStatus=' +${bookdingStatus !=null ? bookdingStatus :''} + '&bookingChangeStatus='+${bookingChangeStatus !=null ? bookingChangeStatus :''} + '&bookingRefundStatus=' +${bookingRefundStatus !=null ? bookingRefundStatus :''}}">&lt;&lt;</a>
          <a class="num" href="">1</a>
          <span class="current" th:text="${nowPage}"></span>
          <a class="num"  th:text="${conPage}" th:href="@{'/book/list?page=' + ${conPage-1} + '&bookingId='+ ${bookingId!=null ? bookingId :''} + '&ticket='+${ticket !=null ? ticket :''} + '&bookingName=' +${bookingName !=null ? bookingName :''} + '&bookdingStatus=' +${bookdingStatus !=null ? bookdingStatus :''} + '&bookingChangeStatus='+${bookingChangeStatus !=null ? bookingChangeStatus :''} + '&bookingRefundStatus=' +${bookingRefundStatus !=null ? bookingRefundStatus :''}}"></a>
          <a class="next" th:href="@{'/book/list?page=' + ${nextPage} + '&bookingId='+ ${bookingId!=null ? bookingId :''} + '&ticket='+${ticket !=null ? ticket :''} + '&bookingName=' +${bookingName !=null ? bookingName :''} + '&bookdingStatus=' +${bookdingStatus !=null ? bookdingStatus :''} + '&bookingChangeStatus='+${bookingChangeStatus !=null ? bookingChangeStatus :''} + '&bookingRefundStatus=' +${bookingRefundStatus !=null ? bookingRefundStatus :''}}">&gt;&gt;</a>
        </div>
      </div>

    </div>
    <script>
        //删除界面
        function deldate(obj){
            //获取当前选中行用户的goodsId
            var bookingId = $(obj).parents("tr").find("td").eq(0).text();
            //调出弹出框
            layer.open({
                content: '请问您是否确定删除该信息？'
                ,btn: ['确定', '取消'],
                btnAlign: 'r',
                anim: 2
                ,yes: function(index, layero){
                    layer.close(index);
                    //发送ajaxj请求
                    $.ajax({
                        url: "/book/delDateBooking",//请求地址
                        type: "post",//请求方式
                        data: {"bookingId": bookingId},
                        dataType: "text",//返回的数据类型 :对象:json,字符串和数字:text
                        success:function (data) {
                            layer.alert("",{icon: 1});
                            setTimeout("window.location.reload();",500)
                        }
                    })
                }
                ,btn2: function(){}
            });
        }

    </script>
  </body>

</html>
